package com.mysterymall.Common.Config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${mystery.rootPath}")
    private String  rootPath;


    @Value("${mystery.resourceRootPath}")
    private String  resourceRootPath;


    /**
     * 静态资源映射
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/dingdang/**").addResourceLocations("file:"+resourceRootPath);
        registry.addResourceHandler("/images/**").addResourceLocations("file:"+rootPath);
    }

}